package com.qf.day31_boot.vo.vo;

import com.qf.day31_boot.utils.Constants;

import java.util.HashMap;

public class ReturnVo extends HashMap {

    public static ReturnVo ok() {

        final ReturnVo returnVo = new ReturnVo();
        returnVo.put("code", Constants.SUCCESS_CODE);
        returnVo.put("msg", "ok");

        return returnVo;
    }

    public static ReturnVo fail() {

        final ReturnVo returnVo = new ReturnVo();
        returnVo.put("code", Constants.FAIL_CODE);
        returnVo.put("msg", "fail");

        return returnVo;

    }

    public static ReturnVo fail(String msg) {

        final ReturnVo returnVo = new ReturnVo();
        returnVo.put("code", Constants.PARAM_NULL_CODE);
        returnVo.put("msg", "msg");

        return returnVo;
    }
}
